<template>
  <div class="bpl1-bg">
    <div class="co-title el-pointer" @click="goPage">
      <div class="co-title-name">
        <img src="@/assets/cockpit/bpl1-title.png" alt="" />
      </div>
      <div class="co-title-right">
        <!-- <div class="co-title-select">
          <el-select v-model="value" placeholder="请选择" :popper-append-to-body="false">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
          </el-select>
        </div> -->
        <div class="co-title-breathe"><i></i><i></i><i></i><i></i><i></i><i></i></div>
      </div>
    </div>
    <div class="bpl-container">
      <div class="bpl1-table">
        <table class="bpl1-tbe">
          <tr class="bpl1-tbeh">
            <th>类型</th>
            <th>登记量(件)</th>
            <th>办结量(件)</th>
            <th>平均办理时长</th>
            <th>正点率</th>
          </tr>
          <tr class="bpl1-tbeb">
            <td class="bpl1-tbeb-title"><p>收文</p></td>
            <td>925</td>
            <td>826</td>
            <td>1<span>天</span></td>
            <td>98.91%</td>
          </tr>
          <tr class="bpl1-tbeb">
            <td class="bpl1-tbeb-title"><p>发文</p></td>
            <td>1623</td>
            <td>1444</td>
            <td>1<span>天</span></td>
            <td>99.20%</td>
          </tr>
        </table>
      </div>
      <ul class="bpl1-stac">
        <li class="bpl1-st-each">
          <i class="bpl1-ste-icon"><img src="@/assets/cockpit/bpl1-st-each-icon1.png" alt=""/></i>
          <div class="bpl1-ste-word">
            <h6>督办事务</h6>
            <p>37/70</p>
            <!-- <p>{{ now }}/{{ total }}</p> -->
          </div>
          <!-- <div class="bpl1-ste-chart">
            <div class="bpl1-ste-chart-base" id="chartOut"></div>
            <div class="bpl1-ste-chart-word">
              <h6>{{ percent }}%</h6>
              <p>正点率</p>
            </div>
          </div> -->
        </li>
        <li class="bpl1-st-line"></li>
        <li class="bpl1-st-each">
          <i class="bpl1-ste-icon"><img src="@/assets/cockpit/bpl1-st-each-icon2.png" alt=""/></i>
          <div class="bpl1-ste-word">
            <h6>会议数量</h6>
            <p>338</p>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import echarts from 'echarts'

@Component({
  name: 'BplItem1',
  components: {}
})
export default class BplItem1 extends Vue {
  private value = '1'
  private options = [
    {
      value: '1',
      label: '长沙市自然资源和规划局'
    },
    {
      value: '2',
      label: '长沙市规划设计院'
    },
    {
      value: '3',
      label: '长沙市住建局'
    }
  ]
  private total = 15
  private now = 12
  private percent = 0
  mounted() {
    this.percent = Number(((this.now / this.total) * 100).toFixed(2))
    // this.initEcharts()
  }
  initEcharts() {
    const chart = echarts.init(document.getElementById('chartOut'), 'walden')
    const options = {
      color: ['#00FFAA', '#fff'],
      series: [
        {
          name: '正点率',
          type: 'pie',
          radius: ['92%', '100%'],
          avoidLabelOverlap: false,
          cursor: 'default',
          hoverAnimation: false,
          label: {
            show: false
          },
          emphasis: {
            label: {
              show: true,
              fontSize: '30',
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: false
          },
          data: [
            {
              value: this.now,
              name: '1',
              itemStyle: {
                normal: {
                  color: 'rgba(0, 255, 170, 1)'
                }
              }
            },
            {
              value: this.total - this.now,
              name: '2',
              itemStyle: {
                normal: {
                  color: 'rgba(255, 255, 255, 0.5)'
                }
              }
            }
          ]
        },
        {
          name: '正点率',
          type: 'pie',
          radius: ['75%', '90%'],
          avoidLabelOverlap: false,
          cursor: 'default',
          hoverAnimation: false,
          label: {
            show: false
          },
          emphasis: {
            label: {
              show: true,
              fontSize: '30',
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: false
          },
          data: [
            {
              value: this.now,
              name: '1',
              itemStyle: {
                normal: {
                  color: 'rgba(0, 255, 170, 0.3)'
                }
              }
            },
            {
              value: this.total - this.now,
              name: '2',
              itemStyle: {
                normal: {
                  color: 'rgba(255, 255, 255, 0.2)'
                }
              }
            }
          ]
        }
      ]
    }
    chart.setOption(options)
    window.addEventListener('resize', () => {
      chart.resize()
    })
  }
  goPage() {
    this.$router.push({ path: '/cockpit/administrationCabin' })
  }
}
</script>
<style lang="scss" scoped>
@import '~@/styles/cockpit.scss';
.bpl1-bg {
  width: 100%;
  height: 100%;
  padding: 12px 120px 12px 16px;
  background: url('~@/assets/cockpit/bpl1-bg.png') no-repeat right center/ 99.3% 100%;
  position: relative;
  &::before {
    content: '';
    display: block;
    width: 20px;
    height: 103%;
    background: url('~@/assets/cockpit/bpl-bg-line.png') no-repeat 0/ 100% 100%;
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translate(0, -50%);
  }
}
.co-title-select {
  ::v-deep .el-input__inner {
    width: 184px;
    height: 28px;
    background: url('~@/assets/cockpit/co-title-select.png') no-repeat 0/ 100% 100%;
    border: none;
    font-size: 12px !important;
    color: #fff;
  }
  ::v-deep .el-input--small .el-input__icon {
    background: url('~@/assets/cockpit/co-title-select-tri.png') no-repeat 0/ 100% 100%;
    line-height: 28px;
    &::before {
      display: none;
    }
  }
}
.bpl1-table {
  width: 100%;
  .bpl1-tbe {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0px 2px;
    text-align: center;
    .bpl1-tbeh {
      height: 20px;
      background: rgba(#fff, 0.1);
      th {
        font-size: 12px !important;
        line-height: 18px;
        color: #bffeff;
        font-weight: 400;
      }
    }
    .bpl1-tbeb {
      td {
        padding: 4px 4px;
        background: rgba(#fff, 0.05);
        font-size: 16px !important;
        line-height: 20px;
        color: #fff;
        font-weight: 500;
        > span {
          font-size: 12px !important;
          color: #fff;
          font-weight: 400;
        }
      }
      .bpl1-tbeb-title {
        padding: 0 0 0 2px !important;
        background: none;
        border-left: 2px solid #006aff;
        position: relative;
        > p {
          width: 100%;
          height: 100%;
          padding: 4px;
          background: rgba(#fff, 0.05);
          line-height: 20px;
          text-align: center;
          font-size: 12px !important;
          color: #fff;
          font-weight: 400;
        }
      }
    }
  }
}
.bpl1-stac {
  width: 100%;
  display: flex;
  flex-flow: row nowrap;
  justify-content: flex-start;
  margin: 12px 0 0 0;
  .bpl1-st-each {
    flex: none;
    display: flex;
    flex-flow: row nowrap;
    padding: 0 24px 0 0;
    .bpl1-ste-icon {
      flex: none;
      width: 64px;
      height: 64px;
      > img {
        display: block;
        width: 100%;
        height: 100%;
      }
    }
    .bpl1-ste-word {
      flex: none;
      > h6 {
        font-size: 12px !important;
        line-height: 18px;
        color: #bffeff;
        text-align: left;
        font-weight: 400;
        margin: 6px 0 0 0;
      }
      > p {
        font-size: 24px !important;
        line-height: 30px;
        color: #fff;
        text-align: left;
        font-weight: 500;
        margin: 4px 0 0 0;
      }
    }
    .bpl1-ste-chart {
      flex: none;
      width: 64px;
      height: 64px;
      padding: 2px;
      position: relative;
      margin: 0 0 0 12px;
      .bpl1-ste-chart-base {
        width: 100%;
        height: 100%;
      }
      .bpl1-ste-chart-word {
        width: 80%;
        position: absolute;
        left: 10%;
        top: 50%;
        transform: translate(0, -50%);
        > h6 {
          font-size: 16px !important;
          text-shadow: 0 0 4px #00ffaa;
          color: #fff;
          line-height: 20px;
          text-align: center;
        }
        > p {
          font-size: 12px !important;
          line-height: 14px;
          color: #bffeff;
          text-align: center;
        }
      }
    }
  }
  .bpl1-st-line {
    flex: none;
    width: 1px;
    height: 64px;
    background: rgba(#fff, 0.1);
    margin: 0 12px;
  }
}
</style>
